<include file="Public/header" xmlns="http://www.w3.org/1999/html"/>
<include file="Public/menu" />
<link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap-switch.min.css">

<style>
    .form-inline .input-group {
        display: inline-table;
        vertical-align: middle;
    }


</style>

<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            统计
            <small>物流统计</small>
        </h1>
        <ol class="breadcrumb">
            <li><i class="fa fa-dashboard"></i> 首页</li>
            <li><a><i class="fa fa-dashboard"></i> 统计</a></li>
            <li class="active">物流统计</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content"><div class="row"><div class="col-md-12"><div class="box">
        <div class="form-inline">

            <form  id="search_form" name="search_form" action=""  method="get" >
        <div class="box-header">
            <h3 class="box-title">日期选择</h3>

            <div class="input-group input-group-sm isOrderChangeDate" >
                <div class="input-group input-group-sm date form_datetime">
                    <input id="start_time" class="form-control start_time"  type="text" name="start_time" value="{$_GET['start_time']|default='开始时间'}" readonly>
                </div>
                <div class="btn-group">-</div>
                <div class="input-group input-group-sm date">
                    <input id="end_time" class="form-control end_time" type="text" name="end_time" value="{$_GET['end_time']|default='结束时间'}" readonly>
                </div>
            </div>

            <div class="input-group input-group-sm">
                <div class="input-group-btn">
                    <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button>
                </div>
                <div class="btn-group pull-right" style="margin-right: 10px">
                    <a href="javascript:;" class="btn btn-sm btn-success"><i
                            class="fa fa-save"></i>&nbsp;&nbsp;生成结算报表</a>
                </div>
            </div>


        </div>

        </form>
        <!-- /.box-header -->
        <div class="box-body table-responsive">
            <table class="table table-hover table-bordered text-center">
                <tbody>
                <tr>
                    <th>日期</th>
                    <th>订单数</th>
                    <th>速配</th>
                    <th>自提</th>
                    <th>快递</th>
                    <th>销售金额/元</th>
                    <th>速配销售额/元</th>
                    <th>自提销售金额/元</th>
                    <th>快递销售金额/元</th>
                </tr>

                <volist name="re_search" id='item'>
                <tr>
                    <td>{$item['day']}</td>
                    <td>{$item['count']}</td>
                    <td>{:$item['supei_num']?$item['supei_num']:0}</td>
                    <td>{:$item['ziti_num']?$item['ziti_num']:0}</td>
                    <td>{:$item['kuaidi_num']?$item['kuaidi_num']:0}</td>
                    <td>{$item['money']}</td>
                    <td>{:$item['supei_money']?$item['supei_money']:"0.00"}</td>
                    <td>{:$item['ziti_money']?$item['ziti_money']:"0.00"}</td>
                    <td>{:$item['kuaidi_money']?$item['kuaidi_money']:"0.00"}</td>
                </tr>
                </volist>
                </tbody>
            </table>
        </div>
            <form action="{:U('goodsSalesExport')}" method="post" id="exportexcel_form">
                <input type="hidden" id="hidden-start-time"  name="hidden-start-time">
                <input type="hidden" id="hidden-end-time" name="hidden-end-time">
            </form>
        <div class="box-footer clearfix">
            {$page}
        </div>

        <!-- /.box-body -->
    </div></div></div>

    </section>


    <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">×
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        生成结算报表
                    </h4>
                </div>
                <form action="{:U('createReport')}">
                    <div class="modal-body">
                        <div class="btn-group">时间段</div>

                        <input id="start_time_b"  class="form-control start_time" type="text" name="start_time" value="{$_GET['start_time']|default='开始时间'}" readonly>
                        <div class="btn-group">~</div>
                        <input id="end_time_b" class="form-control end_time" type="text" name="end_time" value="{$_GET['end_time']|default='结束时间'}" readonly>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                        <button type="submit" class="btn btn-primary  mark-submit">
                            提交
                        </button>
                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>

<script src="/Public/layer/layer.js"></script>
<script src="/Public/admin/laydate/laydate.js"></script>
<script>
    layerTime();
    function layerTime(){
        var start = {
            elem: "#start_time",
            format: 'YYYY-MM-DD',
            min: '1970-01-01 00:00:00', //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: false,
            istoday: false,
            choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: "#end_time",
            format: 'YYYY-MM-DD',
            min: '1970-01-01 00:00:00',
            max: '2099-06-16 23:59:59',
            istime: false,
            istoday: false,
            choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);


        var start_b = {
            elem: "#start_time_b",
            format: 'YYYY-MM-DD',
            min: '1970-01-01 00:00:00', //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: false,
            istoday: false,
            choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end_b = {
            elem: "#end_time_b",
            format: 'YYYY-MM-DD',
            min: '1970-01-01 00:00:00',
            max: '2099-06-16 23:59:59',
            istime: false,
            istoday: false,
            choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start_b);
        laydate(end_b);
    }
    $(function () {
        layerTime();
    $('.btn-success').on('click', function () {

        var star_time = $('#start_time').val();
        var end_time = $('#end_time').val();
        $('#start_time_b').val(star_time);
        $('#end_time_b').val(end_time);
        $('#myModal').modal('show');
      });
    });

</script>

<!-- 底部 -->
<include file="Public/common_footer" />